package com.lzh.template.controller;

import com.lzh.template.common.BaseResponse;
import com.lzh.template.common.ResultUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 测试模块
 * @author LZH
 * @date 2023/5/12
 */
@RestController
@RequestMapping("/test")
public class TestController {


    @PreAuthorize("hasAnyAuthority('系统管理','system:dept:list')")
    @GetMapping("/roleAdmin")
    public BaseResponse<String> testRequest() {
        return ResultUtil.success("hello");
    }

    @GetMapping("/testIp")
    public BaseResponse<String> testIp(String ip) {
        return ResultUtil.success("ip");
    }

    @GetMapping("/testList")
    public BaseResponse<List<TestVo>> testList() {
        List<TestVo> testVoList = new ArrayList<>();
        testVoList.add(new TestVo("1", "aa"));
        testVoList.add(new TestVo("1", "aa"));
        testVoList.add(new TestVo("1", "aa"));
        return ResultUtil.success(testVoList);
    }

    @GetMapping("/testBaidu")
    public BaseResponse<String> testBaidu(String ip) {
        return ResultUtil.success("ip");
    }
}
